
/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2012原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans.factory.xml;

import org.w3c.dom.Node;

import org.springframework.beans.factory.config.BeanDefinitionHolder;

/**
 * Interface used by the {@link DefaultBeanDefinitionDocumentReader}
 * to handle custom, nested (directly under a {@code <bean>}) tags.
 *
 * <p>Decoration may also occur based on custom attributes applied to the
 * {@code <bean>} tag. Implementations are free to turn the metadata in the
 * custom tag into as many
 * {@link org.springframework.beans.factory.config.BeanDefinition BeanDefinitions} as
 * required and to transform the
 * {@link org.springframework.beans.factory.config.BeanDefinition} of the enclosing
 * {@code <bean>} tag, potentially even returning a completely different
 * {@link org.springframework.beans.factory.config.BeanDefinition} to replace the
 * original.
 *
 * <p>{@link BeanDefinitionDecorator BeanDefinitionDecorators} should be aware that
 * they may be part of a chain. In particular, a {@link BeanDefinitionDecorator} should
 * be aware that a previous {@link BeanDefinitionDecorator} may have replaced the
 * original {@link org.springframework.beans.factory.config.BeanDefinition} with a
 * {@link org.springframework.aop.framework.ProxyFactoryBean} definition allowing for
 * custom {@link org.aopalliance.intercept.MethodInterceptor interceptors} to be added.
 *
 * <p>{@link BeanDefinitionDecorator BeanDefinitionDecorators} that wish to add an
 * interceptor to the enclosing bean should extend
 * {@link org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator}
 * which handles the chaining ensuring that only one proxy is created and that it
 * contains all interceptors from the chain.
 *
 * <p>The parser locates a {@link BeanDefinitionDecorator} from the
 * {@link NamespaceHandler} for the namespace in which the custom tag resides.
 *
 * @author Rob Harrop
 * @since 2.0
 * @see NamespaceHandler
 * @see BeanDefinitionParser
 */
/**
 *｛@link DefaultBeanDefinitionDocumentReader｝使用的接口
 *以处理定制的嵌套（直接在｛@code＜bean＞｝下）标记。
 *
 *＜p＞装饰也可能基于应用于
 *｛@code＜bean＞｝标记。实现可以在
 *自定义标记到尽可能多
 *｛@link org.springframework.beans.factory.config.BeanDefinition BeanDefinitions｝作为
 *并转换
 *｛@link org.springframework.beans.factory.config.BeanDefinition｝
 *｛@code＜bean＞｝标记，甚至可能返回完全不同的
 *｛@link org.springframework.beans.factory.config.BeanDefinition｝替换
 *原件。
 *
 *＜p＞｛@link BeanDefinitionDecorator BeanDefinitionDeculators｝应该知道
 *它们可能是链条的一部分。特别是，｛@link BeanDefinitionDecorator｝应该
 *请注意，以前的｛@link BeanDefinitionDecorator｝可能已替换
 *带有
 *｛@link.org.springframework.aop.framework.ProxyFactoryBean｝定义允许
 *要添加的自定义｛@link org.aopalliance.intercept.MethodInterceptor拦截器｝。
 *
 *＜p＞｛@link BeanDefinitionDecorator BeanDefinitionDeculators｝希望添加
 *封闭bean的拦截器应该扩展
 *｛@link org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator｝
 *它处理链接，确保只创建一个代理
 *包含链中的所有拦截器。
 *
 *＜p＞解析器从
 *自定义标记所在的命名空间的｛@link NamespaceHandler｝。
 *
 *@作者Rob Harrop
 *@自2.0起
 *@参见命名空间处理程序
 *@参见BeanDefinitionParser
 */
public interface BeanDefinitionDecorator {

	/**
	 * Parse the specified {@link Node} (either an element or an attribute) and decorate
	 * the supplied {@link org.springframework.beans.factory.config.BeanDefinition},
	 * returning the decorated definition.
	 * <p>Implementations may choose to return a completely new definition, which will
	 * replace the original definition in the resulting
	 * {@link org.springframework.beans.factory.BeanFactory}.
	 * <p>The supplied {@link ParserContext} can be used to register any additional
	 * beans needed to support the main definition.
	 */
	/**
	 *解析指定的｛@link Node｝（元素或属性）并修饰
	 *提供的{@link.org.springframework.beans.factory.config.BeanDefinition}，
	 *返回修饰的定义。
	 *＜p＞实现可以选择返回一个全新的定义
	 *替换结果中的原始定义
	 *{@link.org.springframework.beans.factory.BeanFactory}。
	 *＜p＞提供的｛@link ParserContext｝可用于注册任何其他
	 *bean需要支持主定义。
	 */
	BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext);

}
